home *** CD-ROM | disk | FTP | other *** search
- /*
- --------------------------------------------------------------------
-
- CODE13LJ.C
-
-
- Making a barcode for Postscript
-
- output to the printer i.e.: copy test lpt1 /b
-
-
- --------------------------------------------------------------------
- */
-
- #include <stdio.h>
- #include "barbi.h"
-
- FILE *fp;
-
-
- /* output function for BarBi */
- int BBPutPrintObject(char *object, int len)
- {
- int i;
-
- for(i = 0;i < len;i++)
- {
- if(putc((int) *object++, fp) == EOF)
- return(i);
- }
- return(i);
- }
-
- void main()
- {
- sBBCode Barcode;
- int i;
-
-
- fp = fopen("test","wb");
-
- /* open Barcode library */
- BBOpen(&Barcode);
-
- /* transmit barcode character set */
- BBDownloadPostscript(&Barcode);
- BBPutPrintObject(BBGetPrintObject(&Barcode),
- BBGetPrintObjectLen(&Barcode));
-
- /* set barcode parameter to default */
- BBSetBarcodeDefaults(&Barcode, (fCodeGen) bbCode13);
-
- /* make a Barcode */
- BBMakeBarcode(&Barcode, "123-456:789<0");
-
- /* convert the barcode to Postscript commands */
- BBMakePostscript(&Barcode, 200, 0);
-
- /* positioning barcode */
- BBPutPrintObject("100 200 moveto\n", 15);
-
- /* transmit barcode */
- BBPutPrintObject(BBGetPrintObject(&Barcode), BBGetPrintObjectLen(&Barcode));
-
- /* transmit form feed */
- BBPutPrintObject("showpage\004", 9);
-
- /* close BarBi */
- BBClose(&Barcode);
- }
-